import React, { Component } from 'react'

import {baseUrl} from '../../util/url'

import {LItem} from '../../types/classify'

import {withRouter,RouteComponentProps} from 'react-router-dom'

import './c-item.scss'

interface IProps extends RouteComponentProps{
    item:LItem
}

class CItem extends Component <IProps>{
    render() {
        let {title,img,id} = this.props.item;
        return (
            <dl className="c-item" onClick={() => {
                this.props.history.push('/productList/'+id)
            }}>
               <dt>
                    <img src={baseUrl+img} alt=""/>
                </dt> 
                <dd>
                    {title}
                </dd>
            </dl>
        )
    }
}



export default withRouter(CItem)